<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="/WEB-INF/jsp/common/page_head.jsp" %>

<form action="updateActor.do" method="post" id="actor-user-form">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-15">
                <div class="row">
                    <div class="col-sm-3">
                        <h5>账号：${user.userAcct}</h5>
                    </div>
                    <div class="col-sm-3">
                        <h5>姓名：${user.userName}</h5>
                    </div>
                </div>
                <ul class="list-group">
                    <li class="list-group-item">
                        <h5>请选择角色</h5>
                        <div class="row">
                            <div class="col-sm-10">
                                <c:forEach var="actor" items="${actors}">
                                    <input type="checkbox" class="input_select" id="v_actors-${actor.id}"
                                           name="actorsArr" onclick="changeActor(this.value,this.checked)"
                                           value="${actor.id}"
	                                    <c:forEach var="actoCode" items="${user.actorCodes}">
		                                    <c:if test="${actor.id==actoCode}">
		                                           checked="checked"
		                                    </c:if>
	                                    </c:forEach>
                                	>
                                    ${actor.actorName}&nbsp;&nbsp;
                                </c:forEach>
                            </div>
                        </div>
                    </li>
                    <li id="t_funs" class="list-group-item">
                        <h5>请选择权限</h5>
                        <c:forEach var="module" items="${modules}">
                            <c:if test="${module.code !=1000}">
                                <div class="row">
                                    <div class="col-sm-10">
                                        <h5>${module.name}</h5>
                                        <c:forEach var="func" items="${funcs}">
                                            <c:if test="${func.code > module.code && func.code < module.code+100}">
                                                <input type="checkbox" class="input_select"
                                                       id="user.funCodes-${func.code}" name="funCodesArr"
                                                       onclick="coverBuilding()" value="${func.code}"
                                                <c:forEach var="funCode" items="${user.funCodes}">
	                                                <c:if test="${func.code==funCode}">
	                                                 	checked="checked"
	                                                </c:if>
                                                </c:forEach>
                                                >
                                                ${func.name}&nbsp;&nbsp;
                                            </c:if>
                                        </c:forEach>
                                    </div>
                                </div>
                            </c:if>
                        </c:forEach>
                    </li>
                </ul>
                <button class="btn btn-primary none" type="button" onclick="doSubmit()">确定</button>
                <button class="btn btn-white none" type="button" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
    <input type="hidden" name="id" value="${user.id}"/>
    <div class="layer-btn-class">
        <button class="btn btn-primary" type="button" onclick="doSubmit();">保存</button>
        <button type="button" class="btn btn-white cancle-btn">取消</button>
    </div>
</form>

<script type="text/javascript">
    var actors = new Array();
    var userActors = new Array();
    
    <c:forEach var="actor" items="${actors}"  varStatus="vs">
    	actors[${vs.count-1}] = {
	        id: '${actor.id}',
	        name: '${actor.actorName}',
	        funs: '${actor.stringFunCodes}',
	        flag: '1'
	    };
    </c:forEach>
    
    <c:forEach var="userActor" items="${user.actors}"  varStatus="vs">
    	userActors[${vs.count-1}] = {
	        id: '${userActor.id}',
	        name: '${userActor.actorName}',
	        funs: '${userActor.stringFunCodes}',
	        flag: '1'
    	};
    </c:forEach>
</script>
<script type="text/javascript" src="../asset/js/page/sysmrg/userActor.js" charset="UTF-8"></script>
